package css.sword.fastdfs;

import java.io.*;
import java.net.*;

import javax.annotation.Resource;

public class ServerInfo
{
	protected String ip_addr;
	protected int port;

	public ServerInfo(String ip_addr, int port)
	{
		this.ip_addr = ip_addr;
		this.port = port;
	}
	
	public String getIpAddr()
	{
		return this.ip_addr;
	}
	
	public int getPort()
	{
		return this.port;
	}
	
	public Socket connect() throws IOException
	{
		Socket sock = new Socket();
		sock.setReuseAddress(true);
		sock.setSoTimeout(TrackerClient.G_NETWORK_TIMEOUT);
		sock.connect(new InetSocketAddress(this.ip_addr, this.port), TrackerClient.G_CONNECT_TIMEOUT);
		return sock;
	}
}
